package com.foreknow.mapping;

import java.util.HashMap;
import java.util.Map;

public class MappingFactory {
    private static MappingFactory mappingFactory = null;
    public static Map<String, EntityMapping> maps = new HashMap<>();
    public static final String PERSON_MAPPING = "person_mapping";
    public static final String ADMIN_MAPPING = "admin_mapping";
    public static final String FOOD_MAPPING = "food_mapping";
    public static final String BUSINESS_MAPPING = "business_mapping";
    public static final String GUESTBOOK_MAPPING = "guestbook_mapping";
    private MappingFactory(){
    }

    public static MappingFactory getInstance() {
        if (mappingFactory == null) {
            mappingFactory = new MappingFactory();
            mappingFactory.maps.put(PERSON_MAPPING,new PersonMapping());
            mappingFactory.maps.put(FOOD_MAPPING,new FoodMapping());
            mappingFactory.maps.put(BUSINESS_MAPPING,new BusinessMapping());
            mappingFactory.maps.put(ADMIN_MAPPING,new AdminMapping());
            mappingFactory.maps.put(GUESTBOOK_MAPPING,new GuestbookMapping());
        }
        return mappingFactory;
    }

    public EntityMapping mapping(String key) {
        return maps.get(key);
    }
}
